package cz.pproproj.aaservice.guimodule;

import cz.pproproj.aaservice.guimodule.model.AuthenticationException;
import cz.pproproj.aaservice.guimodule.model.AuthorizationRole;
import cz.pproproj.aaservice.guimodule.model.AuthorizationUser;
import cz.pproproj.aaservice.guimodule.model.Credentials;
import cz.pproproj.aaservice.guimodule.model.User;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author David
 * @since 18. 1. 2015
 */
public interface BLLModuleAccess {

    User authenticate(Credentials credentials, String dataSource) throws AuthenticationException;

    List<Credentials> getAllUsers(String dataSource) throws AuthenticationException;

    List<AuthorizationRole> getRolesFromUser(AuthorizationUser user);

    List<AuthorizationRole> getAllRoles();

    boolean removeRole(AuthorizationRole name);

    boolean addRole(AuthorizationRole name);

    boolean removeMapping(AuthorizationUser user, List<AuthorizationRole> roles);

    boolean addMapping(AuthorizationUser user, List<AuthorizationRole> roles);

    boolean authorize(AuthorizationUser user, AuthorizationRole roleNeededForGrantAccess);

    Map<AuthorizationUser, List<AuthorizationRole>> getAllMappings();
}
